<style scoped>
  .weui-form-preview__hd label, .weui-form-preview__hd em {
    font-size: .9em !important;
  }
  .weui-loadmore_line .weui-loadmore__tips {
    background-color: #eee;
  }
  .rj-cell.max span{
    font-size: 16px;
    padding-right: 20px;
  }
  .rj-cell label {
    color: #333;
    font-size: 14px;
    width: 44%;
    display: inline-block;
    padding: 5px 3%;
    text-align: right;
  }
  .rj-cell span {
    font-size: 14px;
    color: #333;
    display: inline-block;
    width: 50%;
  }
  .rj-cell.note label{
    float: left;
  }
  .rj-cell.note span{
    width: 80%;
    display: inline-block;
  }
  .weui-cells {
    margin-top: 0;
  }
  .weui-cells_form {
    background: #fbfbfb;
  }
  .weui-cell {
    background: #fff;
  }
  .weui-cells__title {
    text-align: left;
  }
  .oitem {
    padding: 3px;
  }
  .hide {
    display: none;
  }
  #acts {
    font-size: 0;
  }
  #acts span {
    font-size: 14px;
  }
  .halfbtn {
    display: inline-block;
    width: 49%;
  }

  .clearfix:after {
    content: ".";
    display: block;
    font-size: 0;
    height: 0;
    clear: both;
    visibility: hidden;
  }
  .clearfix {
    display: inline-table;
  }
  *html .clearfix {
    height: 1%;
  }
  .clearfix {
    display: block;
  }
  *+html .clearfix {
    min-height: 1%;
  }
  .che_tit{
    text-align:center;
    padding:20px;
  }
  .ul_pro{
    background-color:#CED3D9;
    text-align:center;
    padding:4px 2px;
    font-size:14px;
  }
  .ul_pro li{
    float:left;
    width:11.11%;
    padding:2px;
    box-sizing: border-box;
    list-style: none;
  }
  .ul_pro .li_close{
    float:right;
    width:22.22%;
  }
  .ul_pro .li_close span{
    background-color:#ACB3BB;
  }
  .ul_pro .li_clean{
    float:right;
    width:22.22%;
  }
  .ul_pro li span{
    display:block;
    background-color:#fff;
    border-radius:4px;
    box-shadow: 2px 2px 2px #888888;
    /* max-width:48px; margin:0 auto; */
    line-height:32px;
    padding-top:2px;
  }
  .ul_pro li span:active{
    background-color:#4DA9F2;
    color:#fff;
  }
  .ul_input{
    width:auto;
    margin:0 auto;
  }
  .ul_input li{
    float:left;
    width:12%;
    padding:2px;
    text-align:center;
    list-style: none;
  }
  .ul_input li span{
    display: block;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 30px;
    margin: 0 auto;
    height: 30px;
    line-height: 30px;
  }
  .ul_keybord{
    background-color:#CED3D9;
    text-align:center;
    padding:4px 2px;
    font-size:14px;
  }
  .ul_keybord li{
    float:left;
    width:10%;
    padding:2px;
    box-sizing: border-box;
    list-style: none;
  }
  .ul_keybord .ikey20{
    margin-left:5%;
  }
  .ul_keybord .li_w{
    width:11.11%;
  }
  .ul_keybord .li_close{
    float:right;
    width:22.22%;
  }
  .ul_keybord .li_close span{
    background-color:#ACB3BB;
  }
  .ul_keybord .li_clean{
    float:right;
    width:22.22%;
  }
  .ul_keybord li span{
    display:block;
    background-color:#fff;
    border-radius:4px;
    box-shadow: 2px 2px 2px #888888;
    /* max-width:48px; margin:0 auto; */
    line-height:32px;
    padding-top:2px;
  }
  .ul_keybord li span:active{
    background-color:#4DA9F2;
    color:#fff;
  }
  .weui-label{
    text-align: left;
  }
  .weui-cells:before {
    border-top: 0;
  }
</style>
<template>
  <div>
    <div style="height: 50px; line-height: 50px; background: #f7f7f7; text-align: center; font-size: 16px; border-bottom: 1px solid #bdbbbc; position: relative">
      调度信息
      <a href="javascript:;" @click="$router.back(-1)" style="position: absolute; left: 10px; top: 8px">
        <img src="@/assets/back.png" style="width: 20px" />
      </a>
    </div>
    <div class="weui-tab">
      <div class="weui-navbar">
        <div class="weui-navbar__item" :class="{ 'weui-bar__item_on': currentTab == 1 }" @click="switchTab(1)">
          订单信息
        </div>
        <div class="weui-navbar__item" :class="{ 'weui-bar__item_on': currentTab == 2 }" @click="switchTab(2)">
          调度信息
        </div>
      </div>
      <div class="weui-tab__bd">
        <div id="tab1" class="weui-tab__bd-item" :class="{ 'weui-tab__bd-item--active': currentTab == 1 }" >
          <div class="weui-cells weui-cells_form">
            <div class="cellgroup">
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">编号</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" readonly :value="sellform.sellcode" name="">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">申请人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" readonly  type="text"  name="" :value="sellform.applyname">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">所属部门</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" readonly type="text" name="" :value="sellform.depname">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">客户</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" name="" readonly :value="sellform.customername">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">收货地址</label></div>
                <div class="weui-cell__bd">
                  <p style="color: #aaa;text-align: left;">{{sellform.arriProvince + sellform.arriCity + sellform.arriDistrict + sellform.arriAddress}}</p>
                  <!--              <input class="weui-input" type="text" name="" readonly :value="sellform.arriProvince + sellform.arriCity + sellform.arriDistrict + sellform.arriAddress">-->
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">收货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" name="" readonly :value="sellform.arriContact + ' ' + sellform.arriContactNo">
                </div>
              </div>
              <!--          <div class="weui-cell fir">-->
              <!--            <div class="weui-cell__hd"><label class="weui-label">销售形式</label></div>-->
              <!--            <div class="weui-cell__bd">-->
              <!--              <input class="weui-input" readonly name="" :value="sellform.saletypename">-->
              <!--            </div>-->
              <!--          </div>-->
              <!--          <div class="weui-cell">-->
              <!--            <div class="weui-cell__hd"><label class="weui-label">发货库房</label></div>-->
              <!--            <div class="weui-cell__bd">-->
              <!--              <input class="weui-input" readonly type="text" name="" :value="sellform.storeroomname">-->
              <!--            </div>-->
              <!--          </div>-->
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">备注</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" readonly type="text" name="" :value="sellform.remarks">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">创建时间</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" readonly type="text" name="" :value="sellform.createtime">
                </div>
              </div>
              <div class="weui-cell" v-if="orderfiles.length > 0">
                <div class="weui-cell__hd"><label class="weui-label">附件</label></div>
                <div class="weui-cell__bd">
                  <a v-for="(item, index) in orderfiles" :href="item.url">
                    <input class="weui-input" type="text" name="" :value="item.filename">
                  </a>
                  <!--              <input class="weui-input" type="text" name="" :value="baseInfo.createtime">-->
                </div>
              </div>
            </div>
            <div class="oitem"  v-for="(item,index) in allItems" :key="item.guid">
              <div class="weui-cells__title">货品明细{{index + 1}}</div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label for="productguid1" class="weui-label">产品</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" readonly="true" id="productguid1" :value="item.productname">
                </div>
              </div>
              <div class="weui-cell" v-if="item.spname != undefined">
                <div class="weui-cell__hd"><label for="spguid1" class="weui-label">规格</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" readonly="true" id="spguid1" :value="item.spname" >
                </div>
              </div>
              <div class="weui-cell" v-if="sellform.settletype == 1">
                <div class="weui-cell__hd"><label class="weui-label">订单数量</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" :value="item.orderpack" readonly>
                </div>
              </div>
              <div class="weui-cell" v-if="sellform.settletype == 2">
                <div class="weui-cell__hd"><label class="weui-label">订单数量</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input inlinput1" :value="item.weight" readonly>
                  <input class="weui-input inlinput2" :value="item.unit" readonly>
                </div>
              </div>
            </div>
          </div>

        </div>
        <div id="tab2" class="weui-tab__bd-item" :class="{ 'weui-tab__bd-item--active': currentTab == 2 }">
          <form method="post" id="formid">
            <input  name="entity.guid"  id="guid"   type="hidden"  :value="guid" />
            <!--<input  name="openid"  id="openid"   type="hidden"  value="o4kfOwnSU0EZz9GmGb6-3IHVfCMc" />-->
<!--            <input  name="entity.storermguid"  id="storermguid" :value="sellform.storermguid"   type="hidden"   />-->
            <input  name="entity.quitSRType"  id="quitSRType" :value="sellform.quitSRType"  type="hidden"  />
            <input  name="sellType"  id="sellType"   type="hidden"  value="sellDispatch" />
            <div class="weui-cells weui-cells_form">
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">库存组织</label></div>
                <div class="weui-cell__bd">
                  <select class="weui-select rj-line-select" name="" v-model="org">
                    <option value="" disabled>请选择</option>
                    <option v-for="(item, index) in orgs" :value="item.guid">
                      {{item.name}}
                    </option>
                  </select>
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">出库库房</label></div>
                <div class="weui-cell__bd">
                  <input type="hidden" name="entity.storermname" :value="room.name" />
                  <input type="hidden" name="entity.storermguid" :value="room.guid" />
                  <select class="weui-select rj-line-select" name="" v-model="room">
                    <option value="" disabled>请选择</option>
                    <option v-for="(item, index) in rooms" :value="item">
                      {{item.name}}
                    </option>
                  </select>
                  <!--                  <input class="weui-select" type="text" id="storermname" name="entity.storermname" placeholder="请选择库房信息" >-->
                  <!--              <input class="weui-select" v-if="sellform.quitSRType != 2" readonly type="text" name="entity.storermname" :value="sellform.storeroomname"  placeholder="请选择库房信息" >-->
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label id='unqualifiedchkrateDiv' class="weui-label">发货地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input"   type="text" id='deliProvince' name="entity.deliProvince" :value="room.province ? (room.province + ' ' + room.city + ' ' + room.area) : ''"  >
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label  class="weui-label">详细地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='deliAddress' name="entity.deliAddress" :value="room.address || sellform.deliAddress" placeholder=" 请输入发货详细地址">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">发货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input"   id="deliContact" name="entity.deliContact" :value="room.contact || sellform.deliContact"  placeholder=" 请输入发货联系人">
                </div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">联系电话</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="deliContactNo" name="entity.deliContactNo" :value="parseInt(room.contacttel) || sellform.deliContactNo"  placeholder=" 请输入发货人手机号">
                </div>
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__bd">
                <textarea class="weui-textarea opinion" id="opinion" name="description" placeholder="请输入意见内容" rows="2"></textarea>
              </div>
            </div>
            <div ref="actHtml" class="fixcont">
              <div class="weui-btn-area">
                <a class="weui-btn weui-btn_primary halfbtn subbtn"  href="javascript:" @click="send">提交</a>
                <a class="weui-btn weui-btn_primary halfbtn subbtn" v-if="refuseflag == 1" href="javascript:" @click="rejectIt">拒绝</a>
                <a class="weui-btn weui-btn_primary halfbtn" v-else  href="javascript:" @click="$router.back(-1)" id="sub">返回</a>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
    <div id="bmlogs">
      <SalesOperationLogs2 :nodeid="nodeid" :orderid="guid" :srguid="sellform.storermguid" :departid="sellform.depguid"></SalesOperationLogs2>
    </div>
  </div>
</template>

<script>
  import SalesOperationLogs2 from '../common/SalesOperationLogs2'

  export default {
    name: 'SendCar',

    data () {
      return {
        guid : "",
        nodeid : "",
        status: '',
        adata: {},
        sellform: {},
        wlinfo: {},
        annex: '',
        refuseflag: '',
        refuseNodes: [],
        orderfiles: [],
        currentTab: 2,
        allItems: '',
        orgs: [],
        org: '',
        rooms: [],
        room: ''
      }
    },
    components: {
      SalesOperationLogs2
    },
    mounted () {
      //提交操作定位到页面底部
      //$('#bmlogs').css('margin-bottom', this.$refs.actHtml.offsetHeight)

      this.guid = this.$route.query.guid;
      this.nodeid = this.$route.query.nodeid;
      this.annex = this.$route.query.annex;
      this.refuseflag = this.$route.query.refuseflag;
      this.status = this.$route.query.status;
      //
      this.sellDispatch();
      this.loadshrtype();
      this.getRefuseNodes();
      $("#deliProvince").cityPicker({
        title: "请选择发货地址",
      });
      this.getOrgs();
      this.getFiles();
    },
    watch: {
      org: function (val) {
        this.getRooms(val);
        this.room = '';
      }
    },
    methods: {
      getOrgs: function() {
        this.axios({
          method: 'get',
          url: '/produce/Produceplan!getOrgbyWh.action',
          params: {}
        }).then((response) => {
          if (response.data.status == 'true') {
            this.orgs = response.data.result;
          } else if(response.data.status == 'false') {
            this.toastText(response.data.result);
          } else {
            this.toastError("获取库存组织数据失败");
          }

        })
      },
      getRooms: function(orgid) {
        this.axios({
          method: 'get',
          url: '/produce/Storeroom!getStoreroom.action',
          params: {'entity.orgguid': orgid}
        }).then(response => {
          if (response.data.msg == 'success') {
            this.rooms = response.data.storeromms;
          } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
            //不不设置提示
          } else {
            this.toastText('获取库房数据失败');
          }
        });
      },
      switchTab(index) {
        this.currentTab = index;
      },
      getFiles: function() {
        let that = this;
        this.axios({
          method: 'get',
          url: '/sales/Fileinfo!getFileinfo.action',
          params: {orderid: this.guid}
        }).then(response => {
          if (response.data.msg == 'success') {
            this.orderfiles = response.data.files;
          } else {
            //失败时不提示
          }
        });
      },
      getRefuseNodes: function() {
        let that = this;
        this.axios({
          method: 'get',
          url: '/sales/Flowtempnode!getRefuseNodes.action',
          params: {orderid: this.guid, nodeid: this.nodeid}
        }).then(response => {

          if (response.data.msg == 'success') {
            this.refuseNodes = response.data.optNodes.map(function (item) {
              return {text: item.name,
                      onClick: function() {
                        $.confirm("确定要将订单回退到 " + item.name + " 节点？", function() {
                          that.doReject(item.guid, item.name, item.operatorid);
                        })
                      }};
            });
          } else {
            this.toastText('获取可回退节点数据失败!');
          }
        });
      },
      send: function() {
        let that = this;
        if(!checkSubmit(this)){
          return;
        }
        //防止重复提交
        $('.subbtn').attr("disabled",true).css("pointer-events","none");
        //显示提交状态
        $.showLoading("正在提交");

        this.axios({
          method: 'post',
          responseType: 'json',
          headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
          url: '/sales/Sellform!sendCar.action?nodeid=' + this.nodeid + '&status=' + this.status,
          params: this.serialize2Obj($("#formid").serializeArray())
        }).then(response => {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();

          if (response.data.info == 'ok') {
            this.toastSuccess('操作成功!');
            this.$router.push({name: 'Sellform'});
          } else if (response.data.info == 'canotopt') {
            this.toastText('不允许的操作');
          } else {
            this.toastText('操作失败!');
          }
        }).catch(function (error) {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
          that.toastError('系统错误');
        });
      },
      serialize2Obj: function (data) {
        var obj = {};
        $.each(data,function(i,v){
          obj[v.name] = v.value;
        })
        return obj;
      },
      loadstoreroom:function (shrtype){
        let that = this;
        this.guid = this.$route.query.guid;
        $.ajax({
          url: '/repository/Storeroom!getStoreroomJson.action',
          data: {shrtype: shrtype, enable: 1, type: 1},
          type: "post",
          dataType: "json",
          success: function(res) {
            if (res.info != null) {
              var data = res.info;
              var datalist = new Array;

              $.each( data, function( index, itsm ) {
                var info = { "title": itsm.name, "value": itsm.guid, "storeroom":itsm };
                datalist.push(info);
              });
              $('#storermname').select("update", {
                title: "库房信息",
                items: datalist,
                onChange: function (data) {
                  if(data.origins[0] != undefined && data.origins[0] !=null){
                    that.adata = data.origins[0].storeroom;
                    console.log(that.adata)
                    //$('input[name="storermguid"]').val($('#storermname').data('values'));
                    $('#storermguid').val($('#storermname').data('values'));
                    $('#deliProvince').val(that.adata.province + " " + that.adata.city + " " +that.adata.area);
                    $('#deliAddress').val(that.adata.address);
                    $('#deliContact').val(that.adata.contact);
                    $('#deliContactNo').val(that.adata.contacttel);
                  }
                }
              });
            } else {
              that.toastError('系统出现异常!');
            }
          },
          complete: function () {

          }
        });
      },
      loadshrtype:function (){
        let that = this;
        this.guid = this.$route.query.guid;
        $.ajax({
          url: '/repository/Storeroom!getShrtype.action',
          data: {},
          type: "post",
          dataType: "json",
          success: function(res) {
            if (res.info != null) {
              var data = res.info;
              var datalist = new Array;
              $.each( data, function( index, itsm ) {
                var info = { "title": itsm.dicttext, "value": itsm.dictkey  };
                datalist.push(info);
              });
              $('#shrtype').select({
                title: "出库类型",
                items: datalist,
                onChange: function (data) {
                  var shrtype =    $('#shrtype').data('values');
                  $('#quitSRType').val(shrtype)
                  if( shrtype != undefined){
                    // that.loadstoreroom(shrtype);
                    that.clearOption();
                  }
                }
              });
            } else {
              that.toastError('系统出现异常!');
            }
          },
          complete: function () {

          }
        });
      },
      sellDispatch: function (){
        var that = this;
        that.guid = this.$route.query.guid;
        $.ajax({
          url: '/sales/Sellform!sellDispatch.action',
          data: {guid:that.guid},
          type: "post",
          dataType: "json",
          success: function(res) {
            if (res.msg == 'success') {
              that.sellform = res.sellform;
              that.allItems = that.sellform.spitems.concat(that.sellform.items)
              that.wlinfo = res.wlinfo != undefined ? res.wlinfo : {};
              // $('#deliProvince').val(that.sellform.deliProvince + " " + that.sellform.deliCity + " " +that.sellform.deliDistrict);
              // that.loadstoreroom(that.sellform.quitSRType);
            } else {
              that.toastText('获取订单信息失败')
            }
            // if (res.info != 'error' && res.info != '') {
            //   var data = res.info;
            //   $('#storermname').val(data.storeroomname);
            //   $('#storermguid').val(data.storermguid);
            //   // $('#deliContact').val(data.deliContact);
            //   // $('#deliContactNo').val(data.deliContactNo);
            //   //$('#deliProvince').val(data.deliProvince + " " + data.deliCity + " " +data.deliDistrict);
            //   $('#shrtype').val(data.quitSRTypeName);
            //
            //   // $('#deliAddress').val(data.deliAddress);
            //   that.loadstoreroom(data.quitSRType);
            //
            // } else {
            //   that.toastError('系统出现异常!');
            // }
          },
          complete: function () {

          }
        });
      },
      clearOption:function(){
        $('#storermname').val('');
        $('#storermguid').val('');
        $('#deliContact').val('');
        $('#deliContactNo').val('');
        $('#deliProvince').val('');
        $('#deliAddress').val('');

      },
      rejectIt: function () {
        if (!this.checkEmy('opinion')) {
          this.toastText('意见不能为空！');
          return false;
        }
        if (this.refuseNodes.length > 0) {
          $.actions({
            title: '选择回退节点',
            actions: this.refuseNodes
          });
        } else {
          this.toastText('无可回退节点！');
          return false;
        }
      },
      doReject: function (refuseNodeid, refuseNodename, refuseOperatorid) {
        let that = this;
        //防止重复提交
        $('.subbtn').attr("disabled",true).css("pointer-events","none");
        //显示提交状态
        $.showLoading("正在提交");

        let postData = {};
        // postData.imgids = this.images.serverId.join(',');
        postData.imgids = '';
        postData.sellformid = this.guid;
        postData.opinion = ($('#opinion').val() || '') + ' 退回到' + refuseNodename;
        postData.nodeid = this.nodeid;
        postData.refuseNodeid = refuseNodeid;
        postData.backUserid = refuseOperatorid;
        this.axios({
          method: 'post',
          url: '/sales/Sellform!refuse.action',
          params: postData
        }).then((response) => {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();

          if (response.data.msg == 'success') {
            this.toastSuccess('提交成功!');
            this.$router.push({name: 'Sellform'});
          } else if (response.data.msg == 'canotRefuse') {
            this.toastText('不允许拒绝，需删除子订单！');
          } else if (response.data.msg == 'canotopt') {
            this.toastText('不允许的操作！');
          } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
          //不不设置提示
        } else {
          this.toastError('系统错误');
        }
        }).catch(function (error) {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
          that.toastError('系统错误');
        });
      }

    }
  }

  /**
   * 提交之前的校验
   */
  function checkSubmit(that){
    if(that.room == ''){
      alert("请选择库房");
      return false;
    }
    if(isEmpty("deliContact")){
      alert("请填写发货联系人");
      return false;
    }
    if(isEmpty("deliContactNo")){
      alert("请填写发货联系人手机号");
      return false;
    }
    if(isEmpty("deliProvince")){
      alert("请填写发货地址");
      return false;
    }
    if(isEmpty("deliAddress")){
      alert("请填写发货详细地址");
      return false;
    }


    return true;
  }

  function isEmpty(domID){
    return $('#' + domID).val() == "" || $('#' + domID) == null;
  }


</script>
